<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 86176
  Date: 2024/10/28
  Time: 15:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>展示所有图书</title>
</head>
<script src="../../../js/list.js"></script>
<body>
<h3 style="color: blue">欢迎你.${USER_IN_SESSION.username}</h3>
<%--todo头像上传--%>
  <a href="/replaceImg.jsp">
<%--   todo   数据库中存在的是当前项目的图片的路径，通过路径找到项目的真实图片--%>
      <img src="${USER_IN_SESSION.headImg}" title="上传头像" width="2%" alt="图片不存在"/>
  </a>
<br>
<h1><a href="/book?userRequest=input">添加</a></h1>
<form action="/book" method="post">
<table border="1" cellspacing="0px" cellpadding="10px" bgcolor="aqua" width="100%">
    <tr align="center">
        <th>序号</th>
        <th>书名</th>
        <th>价格</th>
        <th>进价</th>
        <th>分类编号</th>
        <th>作者</th>
        <th>操作</th>
    </tr>
    <c:forEach var="book" items="${pageResult.data}">
        <tr align="center" class="myTr">
            <td>${book.id}</td>
            <td>${book.bname}</td>
            <td>${book.salePrice}</td>
            <td>${book.costPrice}</td>
            <td>${book.classify}</td>
            <td>${book.author}</td>
            <td align="center">
                <a href="/book?userRequest=del&id=${book.id}">删除</a>
                <a href="/book?userRequest=input&id=${book.id}">修改</a>
            </td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="7" align="center">
            <a href="/book?currentPage=1">首页</a>
            <a href="/book?currentPage=${pageResult.prevPage}">上一页</a>
            <a href="/book?currentPage=${pageResult.nextPage}">下一页</a>
            <a href="/book?currentPage=${pageResult.totalPage}">尾页</a>
            当前第${pageResult.currentPage}/${pageResult.totalPage}页  一共${pageResult.totalCount}条数据
            跳转到[<input type="text" name="currentPage" value="${pageResult.currentPage}">]页
            每页[
            <select name="pageSize">
                <option value="2" ${pageResult.pageSize==2?'selected':''}>2</option>
                <option value="3" ${pageResult.pageSize==3?'selected':''}>3</option>
                <option value="4" ${pageResult.pageSize==4?'selected':''}>4</option>
            </select>]条数据
        </td>
    </tr>
</table>
</form>
</body>
</html>
